<?
/**
* Copyright (c) 2002-2007 BioWare Corp.
* http://www.bigdaddymonitor.org
*
* This file is part of the BigDaddy Monitoring
* program. It is free software distributed under
* the terms of the BSD License. It is ditributed
* in the hopes that it will be useful, but
* WITHOUT ANY WARRANTY; without event the implied
* warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE.
*
* The BSD License is available from:
* http://www.opensource.org/licenses/bsd-license.php
**/
switch($_REQUEST["action"])
{
	case "addincident":
		$aInfo["title"] = $_POST["title"];
		$aInfo["reasons"] = $_POST["reasons"];
		$aInfo["followup"] = $_POST["followup"];
		$aInfo["description"] = $_POST["description"];
		$aInfo["aServerID"] = $_POST["aServerID"];
		$aInfo["incidentStart"] = mktime($_POST["startHour"], $_POST["startMinute"], 0,$_POST["startMonth"], $_POST["startDay"], $_POST["startYear"]);
		$aInfo["incidentEnd"] = mktime($_POST["endHour"], $_POST["endMinute"], 0,$_POST["endMonth"], $_POST["endDay"], $_POST["endYear"]);
		$BigDaddyControl->SetIncident($aInfo);
		break;
	case "editincident":
		$aInfo["title"] = $_POST["title"];
		$aInfo["reasons"] = $_POST["reasons"];
		$aInfo["followup"] = $_POST["followup"];
		$aInfo["description"] = $_POST["description"];
		$aInfo["aServerID"] = $_POST["aServerID"];
		$aInfo["incidentStart"] = mktime($_POST["startHour"], $_POST["startMinute"], 0,$_POST["startMonth"], $_POST["startDay"], $_POST["startYear"]);
		$aInfo["incidentEnd"] = mktime($_POST["endHour"], $_POST["endMinute"], 0,$_POST["endMonth"], $_POST["endDay"], $_POST["endYear"]);
		$BigDaddyControl->SetIncident($aInfo, $_POST["ID"]);
		
		$redirectTo="page=EditReport&ID=".$_POST["ID"];
		
		break;
	case "deletereport":
		$BigDaddyControl->RemoveIncident($_REQUEST["ID"]);
		break;
	case "addcomment":
		$aInfo["comment"] = $_POST["comment"];
		$BigDaddyControl->SetIncidentComment($aInfo, $_POST["incidentID"]);
		$redirectTo="page=IncidentView&ID=".$_POST["incidentID"]."#comments";
		break;
	case "editcomment":
		$aInfo["comment"] = $_POST["comment"];
		$BigDaddyControl->SetIncidentComment($aInfo, $_POST["incidentID"], $_POST["commentID"]);
		$redirectTo="page=IncidentView&ID=".$_POST["incidentID"]."#comments";
		break;
	case "deletecomment":
		$BigDaddyControl->RemoveIncidentComment( $_REQUEST["commentID"], $_REQUEST["incidentID"]);
		$redirectTo="page=IncidentView&ID=".$_REQUEST["incidentID"]."#comments";
		break;
	
	
}

if ($redirectTo!="")
{
    header("Location: index.html?".$redirectTo);
    exit;
}
else
{
    header("Location: index.html");
    exit;
}
?>
